using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using LayoutPlanning.Model;

namespace LayoutPlanning.Converters
{
    public class TransformConverter : IValueConverter
    {
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var transform = value as TranslateTransform;
            if (transform == null)
                return null;
            return new Point(transform.X, transform.Y);
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var point = value as Point;
            if (point == null)
                return null;
            return new TranslateTransform(point.X, point.Y);
        }
    }
}